        <?php 
            $groups=$viewModel->get('groups');
            $user=$viewModel->get('user');
            //lấy các nhóm quyền người dùng thuộc về
            $getGroups=$viewModel->get('getGroups');
            //lấy id được check
            $IdChecked=array();
            if(count($getGroups)!=0) 
            foreach ($getGroups as $Id) {
                $IdChecked[]=$Id->IdNhom;
            }
        ?>
        <div class="container" style="width:97%">
			<div class="span10 offset1">
				<div class="row" style="color:green;padding-bottom:20px;">
	    			<h3><b>THAY ĐỔI THÔNG TIN THÀNH VIÊN</b></h3>
	    		</div>
    			<form class="form-horizontal" enctype="multipart/form-data" action="<?php echo BASE_URL.'user/adminupdate/'.$user->Id; ?>" method="post">
                    <h4><span class="glyphicon glyphicon-user"></span> Thông tin cá nhân:</h4>
                    <hr>
                    <div class="form-group">
                        <label class="control-label col-md-2" for="name">Họ và tên (*)</label>
                        <div class="col-md-4">
                        <input type="text" class="form-control" name="TenNguoiDung" id="name" value="<?php echo $user->TenNguoiDung; ?>">
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="control-label col-md-2" for="birthday">Ngày sinh </label>
                        <div class="col-md-4">
                        <input type="text" class="form-control" name="NgaySinh" id="birthday" value="<?php echo $user->NgaySinh; ?>">
                        </div>
                    </div>
    				<div class="form-group">
	    				<label class="control-label col-md-2" for="cv">Tiểu sử</label>
	    				<div class="col-md-4">
						<textarea id="cv"  name="TieuSu" class="form-control"><?php echo $user->TieuSu; ?></textarea>
						</div>
    				</div>
                    <h4><span class="glyphicon glyphicon-phone-alt"></span> Thông tin liên hệ:</h4>
                    <hr>
                     <div class="form-group">
                        <label class="control-label col-md-2" for="phonenumber">SĐT</label>
                        <div class="col-md-4">
                        <input type="text" class="form-control" name="SDT" id="phonenumber" value="<?php echo $user->SDT; ?>">
                        </div>
                    </div>
                     <div class="form-group">
                        <label class="control-label col-md-2" for="email">Email</label>
                        <div class="col-md-4">
                        <input type="email" class="form-control" name="Email" id="email" value="<?php echo $user->Email; ?>">
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="control-label col-md-2" for="address">Địa chỉ</label>
                        <div class="col-md-4">
                        <input type="text" class="form-control" name="DiaChi" id="address" value="<?php echo $user->DiaChi; ?>">
                        </div>
                    </div>
                    <h4><span class="glyphicon glyphicon-log-in"></span> Thông tin đăng nhập hệ thống:</h4>
                    <hr>
                    <div class="form-group">
                        <label class="control-label col-md-2">Tên tài khoản: </label>
                        <label class="control-label-text-left col-md-4" style="padding-top:7px;"><?php echo $user->TaiKhoan;?></label>
                    </div>
                    <div class="form-group">
                    <div class="row">
                    <div class="col-md-6" style="padding-left:120px;">
                    <div class="panel panel-default">
                        <div class="panel-heading">Chọn nhóm quyền</div>
                        <div class="panel-body" style="overflow-y: auto; height:350px;">
                            <div class="checkbox">
                                <div>
                                    <label>
                                        <input type="checkbox" onClick="toggle(this)" name="select-all" id="select-all" value="">
                                        Tất cả
                                    </label>
                                </div>
                                <div class="child">
                                <?php foreach ($groups as $group) { ?>
                                <div>                           
                                    <label>
                                        <?php $checked = in_array($group->Id, $IdChecked) ? "checked" : ""; ?>
                                        <input type="checkbox" <?php echo $checked; ?> name="check_list[]" value="<?php echo $group->Id; ?>">
                                        <?php echo $group->MoTa; ?>
                                    </label>
                                </div>
                                <?php } ?>
                                </div>
                            </div>
                        </div>
                    </div>
                        <!-- <div class="col-md-4">
                            <select class="form-control input-sm"  name="IdNhom">
                            <?php $selected='selected'; foreach ($groups as $group) {?>
                            <option value="<?php echo $group->Id; ?>" <?php if($user->IdNhom==$group->Id) echo $selected ?>><?php echo $group->MoTa;?></option>
                            <?php } ?>
                            </select>
                        </div> -->
                    </div>
                    </div>
                    </div>
    				<div class="form-group">
	    				<label class="control-label col-md-2" for="pass">Mật khẩu</label>
	    				<div class="col-md-4">
						<input type="password" class="form-control" name="MatKhau" id="pass" value="<?php echo $user->MatKhau; ?>">
						</div>
    				</div>

    				<div class="form-group">
	    				<label class="control-label col-md-2" for="retypepass">Nhập lại mật khẩu</label>
	    				<div class="col-md-4">
						<input type="password" class="form-control" name="NhapLaiMatKhau" id="retypepass" value="<?php echo $user->MatKhau;?>"> 
						</div>
    				</div>
    				<div class="form-group">
    					<div class="col-md-2"></div>
    					<div class="col-md-4">
    					<button type="submit" class="btn btn-success btn-large">Cập nhật</button>
    					</div>
    				</div>
				</form>
			</div>
		</div>
<script type="text/javascript">
   function toggle(source) {
    checkboxes = document.getElementsByName('check_list[]');
    for(var i=0, n=checkboxes.length;i<n;i++) {
        checkboxes[i].checked = source.checked;
  }
}
 </script>